package cn.sdc.bugKiller.bean;

import java.util.Date;

import cn.sdc.sfw.util.BeanUtil;

public class BugBean {
	
	public static String TBL_NAME = "m_bug";
	
	private Integer id;
    private String title;
    private Integer project;
    private ProjectBean projectBean;
    private String projectName;
    private Integer module;
    private ModuleBean moduleBean;
    private String moduleName;
    private Integer program;
    private ProgramBean programBean;
    private String programName;
    private Integer priority;
    private PriorityBean priorityBean;
    private String priorityName;
    private Integer bugCategroy;
    private BugCategroyBean bugCategroyBean;
    private String bugCategroyName;
    private Integer assigner;
    private MemberBean assignerBean;
    private String assignerName;
    private Integer handler;
    private MemberBean handlerBean;
    private String handlerName;
    private String bugContent;
    private String bugReply;
    private String memo;
    
    /**
     * 1 -> 未修复
     * 2 -> 待审核
     * 3 -> 已关闭
     */
    private Integer status = BugStatus.STATUS_UNFIX;
    private String statusName;
    private Date createDate;
    private Date dueDate;
	private Boolean delFlg;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	public Integer getProject() {
		return project;
	}
	public void setProject(Integer project) {
		this.project = project;
	}
	public ProjectBean getProjectBean() {
		return projectBean;
	}
	public void setProjectBean(ProjectBean projectBean) {
		this.projectBean = projectBean;
	}
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	public Integer getModule() {
		return module;
	}
	public void setModule(Integer module) {
		this.module = module;
	}
	public ModuleBean getModuleBean() {
		return moduleBean;
	}
	public void setModuleBean(ModuleBean moduleBean) {
		this.moduleBean = moduleBean;
	}
	public Integer getProgram() {
		return program;
	}
	public void setProgram(Integer program) {
		this.program = program;
	}
	public ProgramBean getProgramBean() {
		return programBean;
	}
	public void setProgramBean(ProgramBean programBean) {
		this.programBean = programBean;
	}
	public Integer getPriority() {
		return priority;
	}
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	public PriorityBean getPriorityBean() {
		return priorityBean;
	}
	public void setPriorityBean(PriorityBean priorityBean) {
		this.priorityBean = priorityBean;
	}
	public Integer getBugCategroy() {
		return bugCategroy;
	}
	public void setBugCategroy(Integer bugCategroy) {
		this.bugCategroy = bugCategroy;
	}
	public BugCategroyBean getBugCategroyBean() {
		return bugCategroyBean;
	}
	public void setBugCategroyBean(BugCategroyBean bugCategroyBean) {
		this.bugCategroyBean = bugCategroyBean;
	}
	public Integer getAssigner() {
		return assigner;
	}
	public void setAssigner(Integer assigner) {
		this.assigner = assigner;
	}
	public MemberBean getAssignerBean() {
		return assignerBean;
	}
	public void setAssignerBean(MemberBean assignerBean) {
		this.assignerBean = assignerBean;
	}
	public Integer getHandler() {
		return handler;
	}
	public void setHandler(Integer handler) {
		this.handler = handler;
	}
	public MemberBean getHandlerBean() {
		return handlerBean;
	}
	public void setHandlerBean(MemberBean handlerBean) {
		this.handlerBean = handlerBean;
	}
	
	public String getBugContent() {
		return bugContent;
	}
	public void setBugContent(String bugContent) {
		this.bugContent = bugContent;
	}

	public String getBugReply() {
		return bugReply;
	}
	public void setBugReply(String bugReply) {
		this.bugReply = bugReply;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
		this.statusName = BugStatus.statusMap.get(this.status);
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Boolean getDelFlg() {
		return delFlg;
	}
	public void setDelFlg(Boolean delFlg) {
		this.delFlg = delFlg;
	}
	public Date getDueDate() {
		return dueDate;
	}
	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}
	public String getModuleName() {
		return moduleName;
	}
	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}
	public String getProgramName() {
		return programName;
	}
	public void setProgramName(String programName) {
		this.programName = programName;
	}
	public String getPriorityName() {
		return priorityName;
	}
	public void setPriorityName(String priorityName) {
		this.priorityName = priorityName;
	}
	public String getBugCategroyName() {
		return bugCategroyName;
	}
	public void setBugCategroyName(String bugCategroyName) {
		this.bugCategroyName = bugCategroyName;
	}
	public String getStatusName() {
		return statusName;
	}
	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}
	public String getAssignerName() {
		return assignerName;
	}
	public void setAssignerName(String assignerName) {
		this.assignerName = assignerName;
	}
	public String getHandlerName() {
		return handlerName;
	}
	public void setHandlerName(String handlerName) {
		this.handlerName = handlerName;
	}
	
	public BugProcessBean createFirstProcess(){
		BugProcessBean processBean = new BugProcessBean();
		processBean.setBug(id);
		processBean.setAssigner(assigner);
		processBean.setHandler(handler);
		processBean.setStatus(BugStatus.STATUS_NEWASSIGN);
		processBean.setBugReply(bugContent);
		processBean.setReplyDate(createDate);
		return processBean;
	}
	
	public BugProcessBean createReassignProcess(){
		BugProcessBean processBean = new BugProcessBean();
		processBean.setBug(id);
		processBean.setAssigner(assigner);
		processBean.setHandler(handler);
		processBean.setStatus(BugStatus.STATUS_REASSIGN);
		processBean.setBugReply(memo);
		processBean.setReplyDate(createDate);
		return processBean;
	}
	
	public BugBean copyNewBean(){
		BugBean copyBean = new BugBean();
		BeanUtil.copyExpectedFiledBean(this, copyBean
										, "module"
										, "program"
										, "priority"
										, "bugCategroy"
										, "assigner"
										, "handler"
										, "bugContent"
										, "memo");
		return copyBean;
	}
	
}
